Javascript Program For Inserting A Node In A Linked List
We have introduced Linked Lists in the previous post. We also created a simple linked list with 3 nodes and discussed linked list traversal.All programs discussed in this post consider the following representations of the linked list....
read more
Javascript Program For Deleting A Linked List Node At A Given Position
Given a singly linked list and a position, delete a linked list node at the given position....
read more
Javascript Program For Finding Length Of A Linked List
Write a function to count the number of nodes in a given singly linked list....
read more
Javascript Program For Finding The Middle Element Of A Given Linked List
Given a singly linked list, find the middle of the linked list. For example, if the given linked list is 1->2->3->4->5 then the output should be 3. If there are even nodes, then there would be two middle nodes, we need to print the second middle element. For example, if given linked list is 1->2->3->4->5->6 then the output should be 4....
read more
Javascript Program To Check If A Singly Linked List Is Palindrome
Given a singly linked list of characters, write a function that returns true if the given list is a palindrome, else false....
read more
Javascript Program For Removing Duplicates From An Unsorted Linked List
Given an unsorted Linked List, the task is to remove duplicates from the list....
read more
Javascript Program For Searching An Element In A Linked List
Write a function that searches a given key ‘x’ in a given singly linked list. The function should return true if x is present in linked list and false otherwise....
read more
Javascript Program For Rotating A Linked List
Given a singly linked list, rotate the linked list counter-clockwise by k nodes. Where k is a given positive integer. For example, if the given linked list is 10->20->30->40->50->60 and k is 4, the list should be modified to 50->60->10->20->30->40. Assume that k is smaller than the count of nodes in a linked list....
read more
Javascript Program For Reversing A Linked List In Groups Of Given Size – Set 1
Given a linked list, write a function to reverse every k nodes (where k is an input to the function)....
read more
Javascript Program For Removing Duplicates From A Sorted Linked List
Write a function that takes a list sorted in non-decreasing order and deletes any duplicate nodes from the list. The list should only be traversed once. For example if the linked list is 11->11->11->21->43->43->60 then removeDuplicates() should convert the list to 11->21->43->60....
read more
Javascript Program For Flattening A Linked List
Given a linked list where every node represents a linked list and contains two pointers of its type:...
read more
Javascript Program For Swapping Nodes In A Linked List Without Swapping Data
Given a linked list and two keys in it, swap nodes for two given keys. Nodes should be swapped by changing links. Swapping data of nodes may be expensive in many situations when data contains many fields....
read more